#include "CardType.h"
#include "CardTypeData.h"
#include "PokerData.h"
#include <iostream>
#include "CardTypeManager.h"

RoyalStraightFlush::RoyalStraightFlush() {
}

RoyalStraightFlush::~RoyalStraightFlush() {
}

CardTypeData RoyalStraightFlush::getCardType(const PokerData & data) const {
  vector<Poker> pokers = data.getPokers();
  vector<Poker> flushs = PokerData::getFlushData(pokers);
  if (flushs.size() > 4) {
    PokerData::sortData(flushs);
    if (flushs.at(4).value == TEN) {
      CardTypeData cardTypeData;
      cardTypeData.type = CardType::RoyalStraightFlush;
      return cardTypeData;
    }
  } 
  return getNextType()->getCardType(data);
}

const CardType * RoyalStraightFlush::getNextType() const {
  return CardTypeManager::sharedCardTypeManager()->getCardType(CardType::StraightFlush);
}
